package com.yan.club.sys.mapper;

import com.yan.club.sys.model.SysMenu;
import com.yan.club.sys.model.SysMenuExample;
import com.yan.club.sys.vo.MenuVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 彦
 * @since 2024/2/6 21:42
 */
@Mapper
public interface SysMenuMapper {
    long countByExample(SysMenuExample example);

    int deleteByExample(SysMenuExample example);

    /**
     * delete by primary key
     *
     * @param menuId primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Long menuId);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(SysMenu record);

    int insertOrUpdate(SysMenu record);

    int insertOrUpdateSelective(SysMenu record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(SysMenu record);

    List<SysMenu> selectByExample(SysMenuExample example);

    /**
     * select by primary key
     *
     * @param menuId primary key
     * @return object by primary key
     */
    SysMenu selectByPrimaryKey(Long menuId);

    int updateByExampleSelective(@Param("record") SysMenu record, @Param("example") SysMenuExample example);

    int updateByExample(@Param("record") SysMenu record, @Param("example") SysMenuExample example);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(SysMenu record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(SysMenu record);

    int updateBatch(List<SysMenu> list);

    int updateBatchSelective(List<SysMenu> list);

    int batchInsert(@Param("list") List<SysMenu> list);

    List<MenuVo> selectAllMenus();

    List<MenuVo> selectMenusByUserId(Long userId);

    List<MenuVo> selectMenuList(SysMenu menu);

    List<MenuVo> selectMenuListByUserId(SysMenu menu, Long userId);

    SysMenu checkMenuNameUnique(String menuName, Long parentId);

    void updateMenu(SysMenu menu);

    int insertMenu(SysMenu menu);

    /**
     * 根据角色ID查询菜单树信息
     *
     * @param roleId            角色ID
     * @param menuCheckStrictly 菜单树选择项是否关联显示
     * @return 选中菜单列表
     */
    List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);

}